﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Halfpipe.Data.Repository;
using Halfpipe.Data.Service;
using HalfpipeDemo.Data.Model;

namespace HalfpipeDemo.Data.Service
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly", Justification="False positive. The IDisposable implementation *is* in the base class.")]
    public class NorthwindUnitOfWork : UnitOfWork<NorthwindEntities>, INorthwindUnitOfWork
    {
        private Lazy<IEmployeeService> _employees;

        public IEmployeeService Employees 
        { 
            get
            {
                return _employees.Value;
            }
        }

        public NorthwindUnitOfWork()
        {
            _employees = new Lazy<IEmployeeService>(() => new EmployeeService(EntityRepositoryFor<Employee>()), false);
        }
    }
}
